//
//  GoodDetailViewController.m
//  Hero
//
//  Created by lanou3g on 16/5/5.
//  Copyright © 2016年 刘永庆. All rights reserved.
//

#import "GoodDetailViewController.h"
#import "GoodModel.h"
@interface GoodDetailViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *iconImage;
@property (weak, nonatomic) IBOutlet UILabel *nameLable;
@property (weak, nonatomic) IBOutlet UILabel *otherName;
@property (weak, nonatomic) IBOutlet UILabel *mapLable;
@property (weak, nonatomic) IBOutlet UILabel *descipLble;
@property (nonatomic, strong) GoodModel *model;
//@property (nonatomic, strong) NSMutableArray 
@end

@implementation GoodDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"物品详情";
    self.navigationController.navigationBar.backgroundColor = [UIColor brownColor];
    [self reloadDate];
}
- (void)reloadDate
{
    [YQNetWorkRequestManager requestURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://ossweb-img.qq.com/upload/qqtalk/lol_hero/good_%ld.js",self.good_id]] method:YQ_GET params:nil result:^(NSData *data, NSURLResponse *response, NSError *error) {
        if (data) {
            NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
            GoodModel *model = [GoodModel new];
            [model setValuesForKeysWithDictionary:dict];
            self.model = model;
        }
        dispatch_async(dispatch_get_main_queue(), ^{
            self.iconImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"%ld",self.model.good_id]];
            self.nameLable.text = self.model.name;
            self.otherName.text = [self.model.othernames componentsJoinedByString:@","];
            self.descipLble.text = self.model.good_desc;
            self.mapLable.text = [self.model.maplist componentsJoinedByString:@","];
        });
    }];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
